<?php

/**
 * PluginsfSimpleForumPost form.
 *
 * @package    form
 * @subpackage sfSimpleForumPost
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 6174 2007-11-27 06:22:40Z fabien $
 */
class forumPost extends PluginsfSimpleForumPostForm
{
  public function configure()
  {
    parent::configure();
    $user = sfContext::getInstance()->getUser();
    $widgetSchema = $this->getWidgetSchema();
    $validatorSchema = $this->getValidatorSchema();
    
    unset(
      $widgetSchema['created_at'],
      $widgetSchema['updated_at'],
      $widgetSchema['author_name'],
      $widgetSchema['user_id'],
      $widgetSchema['title'],
      $widgetSchema['forum_id']
    );

    unset(
      $validatorSchema['created_at'],
      $validatorSchema['updated_at'],
      $validatorSchema['author_name'],
      $validatorSchema['user_id'],
      $validatorSchema['title'],
      $validatorSchema['forum_id']
    );
    
    $widgetSchema['topic_id'] = new sfWidgetFormInputHidden();
    
    $validatorSchema['content'] = new sfValidatorString(array('required' => true));
    
    $widgetSchema->setNameFormat('forum_post[%s]');

    if(sfContext::getInstance()->getUser()->isAuthenticated()){
          $this->widgetSchema['content'] = new sfWidgetFormTextareaTinyMCE(array(
              'width'  => 473,
              'height' => 114,
              'config' => 'theme : "advanced",
                           mode : "textareas",
                           language : "fr",
                           relative_urls : false,
                           cleanup : true,
                           plugins : "paste,table,advimage,advlink,emotions,preview,searchreplace,print,contextmenu,fullscreen",
                           theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,zoom,forecolor,backcolor,|,link,unlink,image,|,emotions,fullscreen",
                           theme_advanced_buttons2 : "",
                           theme_advanced_buttons3 : "",
                           theme_advanced_disable : "help",
                           theme_advanced_toolbar_location : "top",
                           theme_advanced_toolbar_align : "left",
                           theme_advanced_resizing : true,
                           theme_advanced_resize_horizontal : false,
                           theme_advanced_resizing_use_cookie : false,
                           indentation : "10px",
                           skin : "o2k7",
                           skin_variant : "black",
                           width : "100%",
                           height : "100"'
        ));
      }
  }
}